cmake_minimum_required(VERSION 3.2)

project(jtest CXX)

set(appname tt)


MESSAGE(STATUS "this is project source dir" ${PROJECT_SOURCE_DIR})
MESSAGE(STATUS "this is binary dir" ${PROJECT_BINARY_DIR})

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11"
        )

# path ,var search src file
AUX_SOURCE_DIRECTORY(src src)


#lib下查找cmakelists.txt
add_subdirectory(lib)


#执行输出目录
MESSAGE(STATUS "path  is :" ${PROJECT_BINARY_DIR})
#执行文件输出路径
set(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin)


#生成可执行文件 (可执行文件名称) ,source_file 源文件列表
message(STATUS "out:" ${EXECUTABLE_OUTPUT_PATH})

#protobuf    header and lib path

# lib project
LINK_DIRECTORIES(
        ${PROJECT_SOURCE_DIR}/lib
)
LINK_LIBRARIES(
        libhello.a
)

#include  header
INCLUDE_DIRECTORIES(
        ${PROJECT_SOURCE_DIR}/inlcude
)


MESSAGE(STATUS "linck libL:" ${PROJECT_SOURCE_DIR}/lib)

#生成可执行文件
add_executable(tt ${src})


#boost gudie  http://zh.highscore.de/cpp/boost/
#https://cmake.org/cmake/help/v3.0/module/FindBoost.html
#how to find boost inclides and lib
set(Boost_USE_STATIC_LIBS ON) # only find static libs
set(Boost_USE_MULTITHREADED ON)
set(Boost_USE_STATIC_RUNTIME OFF)
find_package(Boost COMPONENTS date_time thread system filesystem exception timer log log_setup)
if (Boost_FOUND)
    message(STATUS "Boost_INCLUDE_DIR:" ${Boost_INCLUDE_DIR})
    include_directories(${Boost_INCLUDE_DIRS})
    target_link_libraries(${appname} ${Boost_LIBRARIES})
    MESSAGE(STATUS "Boost_LIBRARIES: " ${Boost_LIBRARIES})
endif ()


#find qt
#https://cmake.org/cmake/help/v3.0/manual/cmake-qt.7.html

#target_link_libraries(${appname} libhello.a)
#IF (LINUX)
#    target_link_libraries(${appname} libhello_h.so)
#ELSEIF (MACOSX OR APPLE)
#    target_link_libraries(${appname} libhello_h.dylib)
#ENDIF ()



